package com.ls.constant;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ClassName SystemConstants
 * @Description 常量字段
 * @Author YangLei
 * @Date 2019/5/7 11:13
 * @Version 1.0
 **/
public class SystemConstants {

    //========代理配置启动动态读取======

    public static String sfProxystatus;
    public static String sfProxyIP;
    public static String sfProxyPort;

    /**
     * session中存放的用户key
     */
    public static final String SESSION_USER = "session_user";

    /**
     * session中存放的用户角色id
     */
    public static final String SESSION_USER_ROLE_ID = "session_user_role_id";

    /**
     * session中存放的用户角色key
     */
    public static final String SESSION_ID = "session_id";

    /**
     * token 名字
     */
    public static final String SYS_TOKEN = "Authorization";

    /**
     * 系统用户默认id
     */
    public static final Long SYS_USER_ID = 9999L;

    /**
     * 号百或者电信系统用户默认id
     */
    public static final String TELECOM_USER = "电信";
    /**
     * 系统用户默认id
     */
    public static final String SYS_USER_NAME = "系统";
    /**
     * 系统用户默认密码
     */
    public static final String DEFAULT_PASSWORD = "123456";

    /**
     * 传参不规范,code：400
     */
    public static final Integer PARAM_INCORRECT_CODE = 400;

    /**
     * 成功,code：200
     */
    public static final Integer SUCCESS_CODE = 200;

    /**
     * 服务内部调用失败,code：500
     */
    public static final Integer SERVER_ERROR_CODE = 500;

    /**
     * 操作无记录,code：403
     */
    public static final Integer NO_RECORD_OPERATION = 403;

    /** token失效 */
    public static final int TOKEN_FAIL_CODE = 401;


    /**
     * 错误公共信息
     */
    public static final String SERVER_ERROR_MESSAGE = "error";
    /**
     * 成功公共信息
     */
    public static final String SERVER_SUCCESS_MESSAGE = "success";
    //http请求方式
    public static final String HTTP_METHOD_POST = "POST";
    public static final String HTTP_METHOD_GET = "GET";
    public static final String HTTP_METHOD_PUT = "PUT";
    public static final String HTTP_METHOD_DELETE = "DELETE";

    //http请求类型
    public static final String PARAM_TYPE_QUERY = "query";
    public static final String PARAM_TYPE_BODY = "body";

    public static final String EMPTY_STR = "";
    public static final String FLAG_CITY = "市";

    public static final String STATION_NUMBER_FORMAT = "0000";

    public static final String TEST_VERFICATION_CODE = "1122";

    public static final String APP_TEST_VERFICATION_CODE = "123456";
    public static final String APP_TEST_PHONE = "17602851615";

    public static final int PHONE_LENGTH = 11;
    /**
     * 身份证验证正则
     */
    public static final String IDENTITY_REG = "(^\\d{15}$)|(^\\d{17}(\\d|X)$)";

    /**
     * 电话号码校验(包含手机和座机) 202012废弃不用
     */
    public static final String PHONE_NUMBER_REGEX = "(\\d{2,5}-\\d{7,8})|(^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$)";

    /**
     * 座机号码校验(区号前必须有0)
     */
    public static final String LANDLINE_REGEX = "^0([\\d]{10})|((\\+[0-9]{2,4})?\\(?[0-9]+\\)?-?)?[0-9]{7,8}";


    public static final String SF_NUMBER_REGEX = "[0-9]*";

    /**
     * 手机号码校验0
     */
    public static final String PHONE_NUMBER_VALID_REGEX = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,1,3,5-8])|(18[0-9])|(19[0-9]))\\d{8}$";
    /**
     * 手机号码  23位罂粟3456789 ，没有 012
     */
    public static final String TEL_NUMBER_REGEX = "^1\\d{10}$";

    /**
     * yyyy-MM-dd时间格式正则表达式
     */
    public static final String DATE_YYYY_MM_DD_REGEX = "([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))";
    /**
     * 时分格式正则 HH:mm
     */
    public static final String DATE_HH_MM_REGEX = "^([01]\\d|2[01234]):([0-5]\\d|60)$";
    /**
     * 车牌号校验regex
     */
    public static final String CAR_NUMBER_REGEX = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})";

    //默认时区
    public static final String DEFAULT_TIMEZONE = "GMT+8";
    //默认时间格式
    public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static final String EXCEL_03_FILE_SUFFIX = ".xls";

    public static final String EXCEL_07_FILE_SUFFIX = ".xlsx";
    /**  -1 为注销 */
    public static final int VALID_CANCEL = -1;
    public static final int VALID_FALSE = 0;
    public static final int VALID_TRUE = 1;
    public static final String PLATFORM_SIGN_CONTENT = "乐信通";
    /**节日字段内容为生日*/
    public static final String HOLIDAY_CONTENT_TYPE_BIRTHDAY = "生日";
    /**节日id为6*/
    public static final int HOLIDAY_ID_BIRTHDAY = 6;
    /**表名：可能是sys_user ，也可能是 customer*/
    public static final String TABLE_NAME_USER = "sys_user";
    public static final String TABLE_NAME_CUSTOMER = "customer";
    /**  是否使用平台签名，0使用自定义，1使用乐信通，默认乐信通，2使用智惠信使 */
    public static final int IS_PLATFORM_SIGN_FALSE = 0;
    public static final int IS_PLATFORM_SIGN_TRUE = 1;
    /**  签名审核状态  1 已提交 2 驳回 3 通过  0未新增*/
    public static final int SIGN_VERIFY_STATUS_DEFAULT = 1;
    public static final int SIGN_VERIFY_STATUS_REJECT = 2;
    public static final int SIGN_VERIFY_STATUS_PASS = 3;
    /**  模板类型 0系统模板 1用户模板 */
    public static final int TEMPLATE_TYPE_SYSTEM = 0;
    public static final int TEMPLATE_TYPE_USER = 1;
    /**节日类型  0为农历，1为阳历*/
    public static final int HOLIDAY_TYPE_LUNAR = 0;
    public static final int HOLIDAY_TYPE_SOLAR = 1;
    /**节日重复周期  1为按年重复，2为按月重复，3为按周重复，4为按天重复，0为不重复*/
    public static final int HOLIDAY_REPEAT_CYCLE_YEAR = 1;
    public static final int HOLIDAY_REPEAT_CYCLE_MONTH = 2;
    public static final int HOLIDAY_REPEAT_CYCLE_WEEK = 3;
    public static final int HOLIDAY_REPEAT_CYCLE_DAY = 4;
    public static final int HOLIDAY_REPEAT_CYCLE_NO = 0;
    /**
     * 节假日分类分类 1用户自定义
     */
    public static final int HOLIDAY_CATEGORY_TYPE_USER = 1;

    /**
     * 短信状态 1 失败 2 发送中 3 成功
     */
    public static final int SMS_STATUS_FALSE = 1;
    public static final int SMS_STATUS_SENDING = 2;
    public static final int SMS_STATUS_TRUE = 3;
    /**物流状态   1收件，2发件待发送短信通知，3发件发送短信通知成功，4到件，5派件，6签收，7签收待发短信，8签收发短信成功，9已完成*/
    public static final int LOGISTICS_STATUS_RECEIVE = 1;
    public static final int LOGISTICS_STATUS_SEND_WAIT_SMS = 2;
    public static final int LOGISTICS_STATUS_SEND_SMS_SUCCESS = 3;
    public static final int LOGISTICS_STATUS_DELIVER = 4;
    public static final int LOGISTICS_STATUS_DELIVER_WAIT_SMS = 5;
    public static final int LOGISTICS_STATUS_DELIVER_SMS_SUCCESS = 6;
    public static final int LOGISTICS_STATUS_SIGN = 7;
    public static final int LOGISTICS_STATUS_SIGN_WAIT_SMS = 8;
    public static final int LOGISTICS_STATUS_SIGN_SMS_SUCCESS = 9;
    /**发件短信内容 签收短信内容*/
    public static final String SEND_SMS_CONTENT = "亲，您的$公司名称$$产品名称$ 已发出！快递单号：$快递单号$，快递公司：$快递公司$，祝您生意兴隆！";
    public static final String SIGN_SMS_CONTENT = "亲，您的快递单号：$快递单号$ 已由派送员$操作人$送达至（$站点$），请及时取件，如已签收请忽略！有问题请关注公众号（5G随信通），进行客服咨询！";
    /**
     * 支付类型  1 微信 2支付宝
     */
    public static final int PAY_WEIXIN = 1;
    public static final int PAY_ALIPAY = 2;
    /**
     * 0待支付，1支付成功，2手动交易关闭,3自动关闭,4申请退款，5退款成功,6免费赠送
     */
    public static final int PAY_STATUS_WAIT = 0;
    public static final int PAY_STATUS_SUCCESS = 1;
    public static final int PAY_STATUS_CANCEL = 2;
    public static final int PAY_STATUS_AUTO_CANCEL = 3;
    public static final int PAY_STATUS_APPLY_REFUND = 4;
    public static final int PAY_STATUS_REFUND_SUCCESS = 5;
    public static final int PAY_STATUS_FREE = 6;
    /**呼叫状态 呼入：1拒接，2未接，3已接，呼出：5*/
    public static final int CALL_STATUS_REJECT = 1;
    public static final int CALL_STATUS_NOT_RECEIVE = 2;
    public static final int CALL_STATUS_RECEIVE = 3;
    public static final int CALL_STATUS_OUT_REJECT = 5;
    /**
     * 产品类型：1 会员 period为会员过期月份；2 短信套餐 period为短信套餐过期月份；3 短信加量包 过期时间为当期会员和短信套餐中久的一位
     */
    public static final int PRODUCT_TYPE_MEMBER = 1;
    public static final int PRODUCT_TYPE_SMS = 2;
    public static final int PRODUCT_TYPE_SMS_ADDITION = 3;
    /**短信套餐生效状态 0未生效 1已生效 2已过期 -1已失效*/
    public static final int SMS_PACKAGE_EFFECT_STATUS_FALSE = -1;
    public static final int SMS_PACKAGE_STATUS_DEFAULT = 0;
    public static final int SMS_PACKAGE_STATUS_TRUE = 1;
    public static final int SMS_PACKAGE_STATUS_FALSE = 2;
    /**积分类型：1 每日登录 2 订单消费*/
    public static final long INTEGRAL_TYPE_LOGIN = 1;
    public static final long INTEGRAL_TYPE_ORDER = 2;
    /**重复周期   1为按年重复，2为按月重复，3为按周重复，4为按天重复，0为不重复*/
    public static final int REPEAT_CYCLE_YEAR = 1;
    public static final int REPEAT_CYCLE_MONTH = 2;
    public static final int REPEAT_CYCLE_WEEK = 3;
    public static final int REPEAT_CYCLE_DAY = 4;
    /**数字常量-1*/
    public static final int NUMBER_MINUS_1 = -1;
    /**数字常量0*/
    public static final int NUMBER_0 = 0;
    /**数字常量1*/
    public static final int NUMBER_1 = 1;
    public static final int NUMBER_2 = 2;
    /**ai短信条数10条*/
    public static final int AI_SMS_NUMBER = 10;
    /**模板类别 0为挂机短信，1为关怀短信 ,2为物流短信, 3为预定短信*/
    public static final int TEMPLATE_CATEGORY_HANG_UP = 0;
    public static final int TEMPLATE_CATEGORY_CARE = 1;
    public static final int TEMPLATE_CATEGORY_LOGISTICS = 2;
    public static final int TEMPLATE_CATEGORY_PRE_ORDER = 3;
    /**
     * 是否会员 0否，1会员，-1过期
     */
    public static final int MEMBER_STATUS_FALSE = 0;
    public static final int MEMBER_STATUS_TRUE = 1;
    public static final int MEMBER_STATUS_EXPIRE = -1;

    /*角色 1管理员 2平台客服 3会员 4非会员*/
    public static final int ROLE_ADMIN = 1;
    public static final int ROLE_SERVICE = 2;
    public static final int ROLE_MEMBER = 3;
    public static final int ROLE_NOMEMBER = 4;
    /**
     * 会员等级
     */
    public static final int MEMBER_LEVEL_0 = 0;
    /**
     * 发送通道，1 本机 2 平台
     */
    public static final int CHANNEL_TYPE_CURRENT = 1;
    public static final int CHANNEL_TYPE_PLATFORM = 2;
    /**
     * 登录次数
     */
    public static final int LOGIN_TIMES_1 = 1;
    /**
     * 字符串常量
     */
    public static final String STRING_0 = "0";

    /**
     * 是否判断 否
     */
    public static final int NO = 0;

    /**
     * 是否判断 是
     */
    public static final int YES = 1;
    /**
     * 导入导出EXCEL拓展名
     */
    public static final String EEXCEL_03_FILE_SUFFIX = ".xls";
    /**
     * 验证码key
     */
    public static final String WEB_VERIFY_CODE = "webVerifyCode";
    public static final String SMS_VERIFY_CODE = "smsVerifyCode";
    /**
     * 变更订单状态重试次数
     */
    public static final int RETRY_COUNT = 5;

    /**
     * 短信验证码数字位数
     */
    public static final int PHONE_MESSAGE_CAPTCHA_NUM = 6;

    /**
     * 短信验证码 过期时间5分钟
     */
    public static final int PHONE_MESSAGE_CAPTCHA_EXPIRE_TIME = 300;

    /**
     * 密码强度校验正则(密码必须由10-16位大写字母、小写字母、数字组成)
     */
    public static final String PASSWORD_COMPLEX_VERIFY_REGEX = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[\\s\\S]{10,16}$";


    /**
     * 导入excel 拓展名
     */
    public static final String[] EXCEL_EXPORT_EXTENSION = {"xls", "xlsx"};

    /**
     * 导入门店成员的excel 列数
     */
    public static final int STORE_USER_IMPORT_COLUMN_NUM = 7;

    /**
     * 最大导入列数
     */
    public static final int MAX_IMPORT_NUM = 5000;

    /**
     * H5请求头中的openId参数名
     */
    public static final String SYSTEM_OPEN_ID = "openid";

    public static final int DATE_LENGTH = 10;

    /**
     * 脱敏状态 0 明文 1 密文
     * public static final int DESENTITIZE_PUBLIC = 0;
     * */
    public static final int DESENTITIZE_HIDDEN = 1;

    /**
     * 导出默认值-开始页
     */
    public static final int DEFAULT_EXPORT_START = 1;
    /**
     * 导出默认值-较小
     */
    public static final int DEFAULT_EXPORT_MIN = 100;
    /**
     * 导出默认值-较大  PaginationInterceptor 默认 limit 是 500L
     */
    public static final int DEFAULT_EXPORT_MAX =  999999;
    /**
     * 导出默认值-较大  PaginationInterceptor 默认 limit 是 500L
     */
    public static final int MYBATIS_EXPORT =  -1;
    /**
     * 四川编号/区号
     */
    public static final String SI_CHUAN =  "510000";
    /**
     * 四川编号/区号
     */
    public static final String CHONG_QING =  "500000";

    /*** 登录类型 PC  */
    public static final String PC = "PC";

    /*** 登录类型 微信  */
    public static final String APP = "APP";

    /** 发送优先级2 . 号码归属地为泸州、凉山、宜宾 */
    public static final String[] PRIORRITY_TWO_CITY = new String[]{"5105","5134","5115"};

    public static void main(String[] args) {
        String phone = "028-12345678";
        System.out.println(phone.matches(PHONE_NUMBER_REGEX));
        String phone1 = "02812345678";
        System.out.println(phone1.matches(PHONE_NUMBER_REGEX));
        String phone2 = "13012345678";
        System.out.println(phone2.matches(PHONE_NUMBER_REGEX));
        String phone3 = "19012345678";
        System.out.println(phone3.matches(PHONE_NUMBER_VALID_REGEX));
        String phone4 = "64279167";
        System.out.println(" landlinke1:  "+ phone4.matches(LANDLINE_REGEX));
        String phone5 = "02883268428";
        System.out.println(" landlinke2:  "+phone5.matches(LANDLINE_REGEX));

        String str = "13012345678";
//        String str = "02812345678";
//        String str = "028-12345678";
        String pattern = "0\\d{2,3}-\\d{7,8}|\\(?0\\d{2,3}[)-]?\\d{7,8}|\\(?0\\d{2,3}[)-]*\\d{7,8}";

        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        System.out.println(m.matches());


        String str11 = "2017*11-27 11:03:26";
        String longStr = str11.replaceAll("[^\\d|-]+", "");
        System.out.println("字符串=========：" + longStr);
        //TEL_NUMBER_REGEX
        String phone6 = "18990033287";

    }

}
